home *** CD-ROM | disk | FTP | other *** search
/ Family Forum 261 / SOMC Family Forum 261.iso / Xtras / Behavior Library.cst / 00016_Script_Message Movie in a Window < prev    next >
Text File  |  1997-11-17  |  3KB  |  60 lines

  1. -- Movie in a Window Message 
  2.  
  3.  
  4. -- behavior library version 1.1
  5.  
  6. -- will 'tell' a movie to 'do' something, optionally a text field can be looked at for additional commands.
  7. -- 
  8. -- also functions through lingo by handling message 'initMIAWMessage', 
  9. -- for example if this behavior was assigned to sprite 5, use
  10. -- sendsprite 5, #initMIAWMessage
  11.  
  12. property  windowName, commandName, parameters, whichEvent
  13.  
  14. on initMIAWMessage me
  15.   init me
  16. end
  17.  
  18. on mouseUp me
  19.   if whichEvent = #mouseup    then init me
  20. end
  21.  
  22. on mouseDown me
  23.   if whichEvent = #mousedown  then init me
  24. end
  25.  
  26. on prepareFrame me
  27.   if whichEvent = #prepareframe then init me
  28. end
  29.  
  30. on enterFrame me
  31.   if whichEvent = #enterframe then init me
  32. end
  33.  
  34. on exitFrame me
  35.   if whichEvent = #exitframe  then init me
  36. end
  37.  
  38. on init me
  39.   if ( word 1 of parameters = "field" ) then
  40.     set parameters = the text of field ( word 2 of parameters )
  41.   else if ( word 1 of parameters = "sprite" ) then
  42.     set parameters = field the castNum of sprite ( word 2 of parameters )    
  43.   end if
  44.   set argv = "(" & parameters & ")"
  45.   tell window ( the windowName of me ) to do ( the commandName of me ) && argv
  46. end
  47.  
  48. ---
  49.  
  50. on getPropertyDescriptionList
  51.   
  52.   set p_list = [      #commandName: [ #comment:   "Command:",                       #format:   #string,                      #default:    "                                     " ],       #parameters: [ #comment:   "Parameters:",                       #format:   #string,                      #default:    "                                     " ],       #windowName: [ #comment:   "Target Window:",                       #format:   #string,                      #default:    "" ],       #WhichEvent: [ #comment:   "Initializing Event:",                       #format:   #symbol,                        #range: [ #MouseUp, #MouseDown, #PrepareFrame, #EnterFrame, #ExitFrame, #InitMIAWMessage],                      #default:   #MouseUp ]                  ]
  53.   return p_list  
  54. end
  55.  
  56. on getBehaviorDescription
  57.   return "Sends a command or message to a movie in a window.  Enter arguments in the Parameters text entry box." & RETURN & "PARAMETERS:" & RETURN & "ò Command - Enter the name of command to send window." & RETURN & "ò Parameters - Enter the arguments required by the command." & RETURN & "ò Target Window - Enter the name of the window to which the message should be delivered." & RETURN & "ò Initializing Event - Specify the event that triggers the behavior."& RETURN & "NOTES:" & RETURN & "If the first two words in the Parameters box are 'field' (without quotes) followed by the name of the field cast member (enclosed in double quotes) then the text in the field cast member will be used as the argument for the command begin sent."
  58. end
  59.  
  60.